package cz.proks.easyhelpdesk.gwt.ui.widget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Widget;

import cz.proks.easyhelpdesk.gwt.HelpdeskMessages;

public class HeaderPanel extends Composite {

    private static HeaderWidgetUiBinder uiBinder = GWT.create(HeaderWidgetUiBinder.class);
        
    @UiField HelpdeskMessages i18n;
    @UiField Hyperlink userHyperlink;
    @UiField LogoutHyperlinkButton logoutHyperlink;

    interface HeaderWidgetUiBinder extends UiBinder<Widget, HeaderPanel> {
    }

    public HeaderPanel() {
        initWidget(uiBinder.createAndBindUi(this));                
    } 
    
    public String getUserFullName() {
        return userHyperlink.getText();
    }
                    
    public void setUserFullName(String userFullName) {
        userHyperlink.setText(userFullName);
    }
    
    public void setUserTargetToken(String targetToken) {
        userHyperlink.setTargetHistoryToken(targetToken);
    }
    
    public void setLogoutTargetToken(String targetToken) {
        logoutHyperlink.setTargetHistoryToken(targetToken);
    }
}
